#ifndef PLUGINMANAGER_HEADER
#define PLUGINMANAGER_HEADER

#include <Windows.h>
#include <iostream>
#include <vector>
#include <string>
#include "Plugin.h"

class PluginManager{
public:
	static PluginManager * Instance();	//The public function to access the singleton
	static void create();				//creates 
	static void destroy();

	void setPluginsDLLFolderName(std::string);		//set the name of th plugins(dlls) folder
	std::string getPluginsDLLFolderName() const;

	void loadAllPlugins();				//Load all available plugins
	void unloadAllPlugins();			// Unload all loaded plugins

	Plugin * getPlugins(std::string);	//Get a plugin by its name
private:
	PluginManager();					//Constructor
	~PluginManager();					//Destructor

	HMODULE loadPlugin(std::string);	//Load a plugin and return its handler

	static PluginManager * _instance;	//the one instance
	static char dllFolder[];

	std::vector<std::string> _pluginsDLL; //The available plugins DLL names
	std::vector<HMODULE> _pluginsHandler; //The plugins handlers
	std::vector<Plugin *> _plugins;		//the plugins
};
#endif
#ifndef PLUGIN_EXPORT
	#define PLUGINUSE __declspec(dllimport)	//Export in Plugin project
#else
	#define PLUGINUSE __declspec(dllexport)	//Import in PluginManager class
#endif
extern "C" PLUGINUSE Plugin* createPlugin(PluginManager& mgr); //Create the plugin object
typedef Plugin* (*PCREATEFUNC)(PluginManager&);